package IO流.综合练习.登录注册;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class 第一题 {
    public static void main(String[] args) throws IOException {
        Scanner sc=new Scanner(System.in);
        //1.提示用户进行输入
        System.out.print("请输入你的用户名:");
        String username = sc.nextLine();
        System.out.print("请输入你的密码:");
        String password = sc.nextLine();
        //2.读取文件中的数据
        BufferedReader br=new BufferedReader(new FileReader("F\\username.txt"));
        String[] split = br.readLine().split("&");
        br.close();
        //获取用户名
        String name = split[0].split("=")[1];
        //获取密码
        String pass = split[1].split("=")[1];
        //进行判断
        if (name.equals(username)&&pass.equals(password)){
            System.out.println("登录成功!");
        }else {
            System.out.println("登录失败");
        }
    }
}
